{include file="public/open_head" /}

<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">修改密码</div>
                <div class="layui-card-body" >

                    <div class="layui-form" lay-filter="">


                        <div class="layui-form-item" >
                            <label class="layui-form-label " >当前密码：</label>
                            <div class="layui-input-inline" >
                                <input type="password" name="oldpassword" lay-verify="required" lay-vertype="tips"  placeholder="请输入当前密码" class="layui-input layui-form-danger" >
                            </div >
                        </div >

                        <div class="layui-form-item" >
                            <label class="layui-form-label" >新密码：</label>
                            <div class="layui-input-inline" >
                                <input type="password" name="sg_password" lay-verify="required" lay-vertype="tips" placeholder="请输入新密码" autocomplete="off" class="layui-input" >
                            </div >
                            <div class="layui-form-mid layui-word-aux" >6到16个字符，包含字母和数字</div >
                        </div >

                        <div class="layui-form-item" >
                            <label class="layui-form-label" >确认密码：</label>
                            <div class="layui-input-inline" >
                                <input type="password" name="repassword" lay-verify="required" lay-vertype="tips" autocomplete="off" class="layui-input" >
                            </div >
                        </div >



                        {:token()}


                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="setmypass">确认修改</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>


<script >

    layui.use(['form', 'jquery'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        form.on('submit(setmypass)', function (data) {
            //lucky.FormSubmit("{:url('index/changepwd')}",data.field);
            var load=layer.load(2);
            $.ajax({
                url:"{:url('index/changepwd')}",
                dataType:"json",
                type:'post',
                //data:$("#form").serialize(),
                data:data.field,
                success:function(data){
                    if(data.code==1)
                    {
                        layer.msg(data.msg, {icon: 1, time: 1500, anim: 4,shade:0.5}, function () {
                            layer.close(load);
                            window.location.reload();
                        });
                    }
                    else
                    {
                        layer.msg(data.msg, {icon: 5, time: 1000, anim: 4,shade:0.5}, function () {
                            layer.close(load);
                            //$('.captcha img').attr('src', '/captcha?id=' + Math.random());
                        });
                    }
                }
            });
            return false;
        });

    });

</script >

</body >
</html >